import { locale } from 'dayjs';

import 'dayjs/locale/en';
import 'dayjs/locale/zh-cn';

import { globalConfig } from '@/config';

export const setDayjsLocale = () => {
  const localeMap = {
    'en-US': 'en',
    'zh-CN': 'zh-cn',
  } satisfies Record<App.I18n.LangType, string>;

  locale(localeMap[globalConfig.defaultLang]);
};
